Xbasic

BOTTOM_PERCENT_RECORDS Function

Syntax

Filter_Expression as C = bottom_percent_records(percent as n[,filter as c])

Arguments

Filter_Expression

A character filter expression that selects records from a table. Numeric

percent

A positive number less than or equal to 100. Numeric

filter

Optional. A character filter expression that evaluates to a logical value and selects records from the table.

Description

Return the bottom N percent of records for a given sort order.

Discussion

BOTTOM_PERCENT_RECORDS() is a special function used only in queries to return the bottom Percent of records in a table for a given sort order. If the optional filter is supplied, only the records selected by the filter are returned. Note : The term "bottom" does not imply that record values are examined. "Bottom" means last, given the current sort order.

Example

See Record Sampling Functions for more information. The following query, which could be attached to a button on a form, returns the bottom 10% of students in a school.

dim tbl as P
dim inx as P
tbl = table.current()
query.filter = "bottom_percent_records(10)"
query.order = "grade_point_average"
inx = tbl.query_create()
topparent.resynch()

See Also